package cn.zzzyuan.controller;


import cn.zzzyuan.common.entity.ResponseResult;
import cn.zzzyuan.entity.Content;
import cn.zzzyuan.entity.Doc;
import cn.zzzyuan.service.ContentService;
import cn.zzzyuan.service.DocService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 文档内容 前端控制器
 * </p>
 *
 * @author
 * @since 2022-04-13
 */
@RestController
@RequestMapping("/content")
@Slf4j
public class ContentController {

    private final ContentService contentService;

    private final DocService docService;

    public ContentController(ContentService contentService, DocService docService) {
        this.contentService = contentService;
        this.docService = docService;
    }

    @GetMapping("/get/{id}")
    public ResponseResult getContent(@PathVariable("id")Integer id){
        log.info("=================查询的contentid : {}===========",id);
        Content content = contentService.getOne(new QueryWrapper<Content>().eq("id", id));
        // todo
        return ResponseResult.success(content);

    }

}
